# 使用官方镜像 
FROM ubuntu 
#编写作者信息
MAINTAINER "fengyuenheqi@163.com"
# 更新源，安装ssh server
#RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe"> /etc/apt/sources.list
#RUN apt-get update
#RUN apt-get install -y openssh-server
#RUN mkdir -p /var/run/sshd

# 设置root ssh远程登录密码为123456
#RUN echo "root:123456" | chpasswd 

#安装vim 等
RUN apt-get update
RUN apt-get install -y vim 

#添加jdk,tomcat目录
RUN mkdir /usr/local/jdk
RUN mkdir /usr/local/tomcat
RUN mkdir /var/tmp/tomcat

#安装jdk,tomcat
ADD jdk-7u80-linux-x64.tar.gz /usr/local/jdk
ADD apache-tomcat-7.0.85.tar.gz /var/tmp/tomcat
#移动文件位置
RUN mv /var/tmp/tomcat/apache-tomcat-7.0.85/*  /usr/local/tomcat
#删除临时目录
RUN  rm -rf /var/tmp/tomcat/apache-tomcat-7.0.85
RUN  rm -rf /var/tmp/tomcat

#配置java与tomcat环境变量
ENV JAVA_HOME /usr/local/jdk/jdk1.7.0_80
ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
ENV CATALINA_HOME /usr/local/tomcat
ENV CATALINA_BASE /usr/local/tomcat
ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/lib:$CATALINA_HOME/bin

#设置时区
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
#修改容器编码为utf-8
ENV LANG C.UTF-8

#容器运行时监听的端口
EXPOSE  8080
#启动tomcat服务
CMD ["./usr/local/tomcat/bin/catalina.sh","run"] && tail -f /usr/local/tomcat/logs/catalina.out 